package com.edu.design.proxy.paymodel;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class PaymentInvocationHandle implements InvocationHandler {
	
	private Object target;
	
	public PaymentInvocationHandle(Object pTarget){
		target = pTarget;
	}

	@Override
	public Object invoke(Object pProxy, Method pMethod, Object[] pArgs) throws Throwable {
		Object result = pMethod.invoke(target, pArgs);
		return result;
	}
	
	public Object getProxy(){
		Class<?> clz = target.getClass();
		return Proxy.newProxyInstance(clz.getClassLoader(), clz.getInterfaces(), this);
	} 

}
